/**
 * 
 */
package co.droidforum.foodx.exception.handlers;

import android.widget.Toast;
import co.droidforum.foodx.R;
import co.droidforum.foodx.application.AplicationContext;
import co.droidforum.foodx.workers.BusinessWorker;
import co.droidforum.foodx.workers.ProcessExceptionHandler;

/**
 * @author andres.alzate
 *
 */
public class AppExceptionHandler implements ProcessExceptionHandler {

	/* (non-Javadoc)
	 * @see co.droidforum.foodx.workers.ProcessExceptionHandler#isHandlerFor(java.lang.Class)
	 */
	public boolean isHandlerFor(Class<? extends Exception> clazz) {
		return true;
	}

	/* 
	 * (non-Javadoc)
	 * @see co.droidforum.foodx.workers.ProcessExceptionHandler#handleException(java.lang.Exception, co.droidforum.foodx.workers.BusinessWorker)
	 */
	public void handleException(Exception e, BusinessWorker businessWorker) {
		String mensaje = AplicationContext.getValueStringResource(R.string.msg_fatal);
		
		Toast toast = Toast.makeText(AplicationContext.getContextApp(), mensaje, Toast.LENGTH_LONG);
		toast.show();
	}
}